<template>
  <div>
    <b>填写反馈</b>
    <ul class="type02">
      <li :class="{ active: type === '合适' }" @click="type = '合适'">合适</li>
      <li :class="{ active: type === '不适合' }" @click="type = '不适合'">
        不适合
      </li>
      <li :class="{ active: type === '自定义' }" @click="type = '自定义'">
        自定义
      </li>
    </ul>
    <p v-if="type === '自定义'">
      <van-field
        v-model="postData.content"
        rows="5"
        autosize
        type="textarea"
        maxlength="100"
        show-word-limit
        placeholder="请填写反馈意见"
        class="text"
      />
    </p>
    <p>
      <van-button
        round
        type="primary"
        text="取消"
        class="btn"
        @click="onCancle"
      ></van-button>
      <van-button
        round
        type="primary"
        text="保存"
        class="btn"
        :loading="loading_submit"
        :disabled="disable_submit"
        @click="onSubmit"
      ></van-button>
    </p>
  </div>
</template>

<script>
import { Button, Field } from "vant";
import { CompanyResumeSubResumeApplyResult } from "@/util/http";
import Global from "@/Global";
export default {
  name: "ResumeResult",
  components: {
    [Button.name]: Button,
    [Field.name]: Field,
  },
  props: ["resumeid", "rowid"],
  created() {
    this.postData.resumeid = this.resumeid;
    this.postData.rowid = this.rowid;
  },
  // 定义属性
  data() {
    return {
      postData: {
        resumeid: "",
        rowid: "",
        content: "",
      },
      type: "",
      loading_submit: false,
    };
  },
  watch: {
    type(val) {
      this.postData.content = val != "自定义" ? val : "";
    },
  },
  computed: {
    disable_submit() {
      if (this.postData.content.trim().length > 0) return false;
      return true;
    },
  },
  // 方法集合
  methods: {
    onCancle() {
      this.$bus.$emit(Global.bus_company_resume_showinfo_update, 0);
    },
    onSubmit() {
      this.loading_submit = true;
      CompanyResumeSubResumeApplyResult(this.postData).then((res) => {
        // console.log(res);
        this.loading_submit = false;
        this.$bus.$emit(Global.bus_company_resume_showinfo_update, res.result);
      });
    },
  },
};
</script>

<style scoped></style>
